using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TalentData : MonoBehaviour
{
    // Start is called before the first frame update
    public static GameObject[] talent1, talent2, talent3, talent4;
    public GameObject[] Talent1, Talent2, Talent3, Talent4;
    public static GameObject[] talents=new GameObject[3];
    public static float possibility4=2f, possibility3=8f, possibility2=20f;
    public static void NewTalents()
    {
        for(int i = 0; i < 3; i++)
        {
            float t = Random.Range(0f, 100f);
            if (t <= possibility4)
            {
                if (PlayerData.fly == true|| talents[0] == talent4[0]|| talents[1] == talent4[0]|| talents[2] == talent4[0])
                    talents[i] = talent4[Random.Range(1, talent4.Length)];
                else talents[i] = talent4[Random.Range(0, talent4.Length)];
            }
            else if (t <= possibility3 + possibility4)
            {
                if (PlayerData.jumpnum>1 || talents[0] == talent3[0] || talents[1] == talent3[0] || talents[2] == talent3[0])
                    talents[i] = talent3[Random.Range(1, talent3.Length)];
                else talents[i] = talent3[Random.Range(0, talent3.Length)];
            }
            else if(t <= possibility2+possibility3 + possibility4)
            {
                talents[i] = talent2[Random.Range(0, talent2.Length)];
            }
            else
            {
                talents[i] = talent1[Random.Range(0, talent1.Length)];
            }
        }
    }
    void Start()
    {
        talent1 = Talent1;
        talent2 = Talent2;
        talent3 = Talent3;
        talent4 = Talent4;
        NewTalents();
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
